package com.shangqing.document_management.jwt;

import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.shangqing.document_management.entity.User;
import lombok.Data;

import java.io.Serializable;
@Data

public class Token implements Serializable {
    public  String getToken(User user){
        String token="";
        token= JWT.create().withAudience(String.valueOf(user.getId()))
                .sign(Algorithm.HMAC256(user.getPassword()));
        return token;
    }
}
